/**
 * 
 */
package ua.ws.feedsreader.actions;

import java.util.Map;

import ua.ws.feedsreader.common.FeedEntry;
import ua.ws.feedsreader.common.User;
import ua.ws.feedsreader.db.SemanticManager;
import ua.ws.feedsreader.utils.Log;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

/**
 * @author ricardo
 *
 */
public class FeedsSuggestions extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6789610154690978039L;

	private String keyword;
	private Map<Integer, FeedEntry> suggestionFeeds;
	
	@Override
	public String execute() throws Exception {
		Map<String, Object> session = ActionContext.getContext().getSession();
		Log.debug("FeedsSuggestions");
		User user = (User) session.get("USER");
		Log.debug("FeedsSuggestions - User:"+user.getLogin() +" keyword="+ keyword );
		SemanticManager semanticManager = new SemanticManager();
		suggestionFeeds = semanticManager.getFeedsSugestion( keyword, user.getLogin() );
		
		return SUCCESS;
	}

	/**
	 * @return the keyword
	 */
	public String getKeyword() {
		return keyword;
	}

	/**
	 * @param keyword the keyword to set
	 */
	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}

	/**
	 * @return the suggestionFeeds
	 */
	public Map<Integer, FeedEntry> getSuggestionFeeds() {
		return suggestionFeeds;
	}

	/**
	 * @param suggestionFeeds the suggestionFeeds to set
	 */
	public void setSuggestionFeeds(Map<Integer, FeedEntry> suggestionFeeds) {
		this.suggestionFeeds = suggestionFeeds;
	}
}
